package com.norma.macaron.service.common.repository.user;

import com.norma.macaron.service.common.domain.user.TPermission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Set;

@Repository
public interface PermissionRepository extends JpaRepository<TPermission, String>, JpaSpecificationExecutor<TPermission> {

    @Query(value = "select distinct(permission.menu_id) from TPermission  permission where permission.role_id in :roleIds")
    Set<String> getMenuIdInRoleId(@Param("roleIds") String[] roleIds);

}
